<%@ Page Title="" MasterPageFile="~/BackOffice.master" Language="C#" AutoEventWireup="true" CodeBehind="CadastroCategoria.aspx.cs" Inherits="MakeIT.MakeIT.Laundy.Agromotor.Site.Apresentacao.CadastroCategoria" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<asp:Content ID="cHeadHttpEquiv" ContentPlaceHolderID="headHttpEquiv" runat="server">
</asp:Content>
<asp:Content ID="cHead" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="cCadastro" ContentPlaceHolderID="cphTituloCadastro" runat="server">
    Cadastro de Categoria&nbsp;de&nbsp;pe&ccedil;as (categoria)
</asp:Content>

<asp:Content ID="cMain" ContentPlaceHolderID="cphMain" runat="server">

    <asp:UpdatePanel ID="upnCategoria" runat="server">
        <ContentTemplate>
            <asp:TabContainer ID="tabCategoria" runat="server" ActiveTabIndex="0">
                <asp:TabPanel ID="tabPesquisa" runat="server" HeaderText="Pesquisa">
                    <ContentTemplate>
                        <div style="width: 100%; background-color:#eeeeff; min-width:400px; min-height:300px;">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td valign="middle" style="width:24px;">
                                        <asp:ImageButton ID="ibPesquisa" runat="server" OnClick="btnPesquisa_Click" 
                                                  ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/search.png" 
                                                  ToolTip="Executa a pesquisa aplicando os filtros"/>
                                    </td>
                                    <td valign="middle" align="left">
                                        Filtros:
                                    </td>
                                    <td>
                                        <div class="FormDiv">
                                            <div class="FormLabel">C&oacute;digo:</div>
                                            <asp:TextBox ID="txtIdCategoria" MaxLength="11" Width="76" onkeypress="strictNum();" onblur="validaDecimal(this.value,11,0);" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                            <asp:MaskedEditExtender ID="meetxtIdCategoria" runat="server" Mask="99999999999" TargetControlID="txtIdCategoria" PromptCharacter="" />
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">Categoria:</div>
                                            <asp:TextBox ID="txtCategoria" MaxLength="30" Width="100" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">Palavras&nbsp;chaves:</div>
                                            <asp:TextBox ID="txtChaves" MaxLength="0" Width="100" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <hr />
                            <asp:GridView ID="grvResultado" runat="server" AutoGenerateColumns="False" EmptyDataText="N&atilde;o foram encontrados registros nessa pesquisa!"
                                  CellPadding="1" ForeColor="#333333" GridLines="Both"  RowStyle-ForeColor="#333333" RowStyle-BackColor="#F7F6F3" >
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgbVisualizar" runat="server" OnClick="imgbVisualizar_Click"
                                                ImageUrl="~/App_Themes/Padrao/imagens/backoffice/editar.gif" CommandArgument='<%#Eval("PKString") %>'
                                                ToolTip="Abrir formulário completo" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="idCategoria" HeaderText="C&oacute;digo" DataFormatString="{0:N0}"/>
                                    <asp:BoundField DataField="categoria" HeaderText="Categoria"/>
                                </Columns>
                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <EditRowStyle BackColor="#999999" />
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                            </asp:GridView>
                        </div>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="tabCadastro" runat="server" HeaderText="Cadastro">
                    <ContentTemplate>
                        <asp:Panel ID="panelCad" runat="server" BackColor="#eeeeee">
                            <div style="width: 100%; min-width:400px; min-height:300px;">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td>
                                            <asp:Panel ID="panelBotoes" runat="server">
                                                <asp:Button ID="btnSalvar" runat="server" Enabled="False" ValidationGroup="Salvar"
                                                    OnClick="btnSalvar_Click" Text="Salvar" UseSubmitBehavior="false"/>
                                                &nbsp;<asp:Button ID="btnCancelar" runat="server" OnClick="btnCancelar_Click" 
                                                    Text="Cancelar" UseSubmitBehavior="false"/>
                                                <asp:Button ID="btnEditar" runat="server" Enabled="False" 
                                                    OnClick="btnEditar_Click" Text="Editar" UseSubmitBehavior="false"/>
                                                &nbsp;<asp:Button ID="btnExcluir" runat="server" Enabled="False" 
                                                    OnClick="btnExcluir_Click" Text="Excluir" UseSubmitBehavior="false"/>
                                                &nbsp;<asp:Button ID="btnNovo" runat="server" 
                                                    OnClick="btnNovo_Click" Text="Novo" UseSubmitBehavior="false"/>
                                                <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnExcluir" ConfirmText="Confirma a exclus&atilde;o de Categoria&nbsp;de&nbsp;pe&ccedil;as?">
                                                </asp:ConfirmButtonExtender>
                                                <hr />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">C&oacute;digo:</div>
                                                <asp:TextBox ID="txtCadIdCategoria" MaxLength="11" Width="76" onkeypress="strictNum();" onblur="validaDecimal(this.value,11,0);" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                                <asp:MaskedEditExtender ID="meetxtCadIdCategoria" runat="server" Mask="99999999999" TargetControlID="txtCadIdCategoria" PromptCharacter="" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Categoria:</div>
                                                <asp:TextBox ID="txtCadCategoria" MaxLength="30" Width="190" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                                <asp:RequiredFieldValidator ControlToValidate="txtCadCategoria" 
                                                   ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvtxtCadCategoria" Display="None"
                                                   runat="server" ValidationGroup="Salvar" ></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vcetxtCadCategoria" runat="server" TargetControlID="rfvtxtCadCategoria"></asp:ValidatorCalloutExtender>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Palavras&nbsp;chaves:</div>
                                                <asp:GridView ID="grvCadCategoriaXChaves" runat="server" AutoGenerateColumns="False" 
                                                    EmptyDataText="Sem Chave(s) cadastradas"
                                                    ShowFooter="True"
                                                    OnRowDataBound="grvCadCategoriaXChaves_RowDataBound"
                                                    OnRowCancelingEdit="grvCadCategoriaXChaves_RowCancelingEdit" 
                                                    OnRowEditing="grvCadCategoriaXChaves_RowEditing" 
                                                    OnRowUpdating="grvCadCategoriaXChaves_RowUpdating" 
                                                    OnRowCommand="grvCadCategoriaXChaves_RowCommand" 
                                                    OnRowDeleting="grvCadCategoriaXChaves_RowDeleting"
                                                    RowStyle-Wrap="false"
                                                    RowStyle-Font-Bold="true"
                                                    RowStyle-ForeColor="#000080"
                                                    RowStyle-Font-Size="8pt"
                                                    BorderStyle="Dashed" BorderColor="#808080" BorderWidth="1"> 
                                                    <HeaderStyle Font-Bold="True" Font-Italic="true" Font-Size="7pt" ForeColor="#404040" />
                                                    <Columns>
                                                        <asp:TemplateField HeaderText="Alternativas">
                                                            <EditItemTemplate> 
                                                               <div class="FormLabel">Chave:</div>
                                                               <asp:TextBox ID="txtCadChave" Width="350" Text='<%# Eval("Value") %>' ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                                               <asp:RequiredFieldValidator ControlToValidate="txtCadChave" 
                                                                  ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvtxtCadChave" Display="None"
                                                                  runat="server" ValidationGroup="SalvarCategoriaXChave" ></asp:RequiredFieldValidator>
                                                               <asp:ValidatorCalloutExtender ID="vcetxtCadChave" runat="server" TargetControlID="rfvtxtCadChave"></asp:ValidatorCalloutExtender>
                                                            </EditItemTemplate> 
                                                            <FooterTemplate> 
                                                               <div class="FormLabel">Chave:</div>
                                                               <asp:TextBox ID="txtCadNewChave" Width="350" Text='<%# Eval("Value") %>' ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                                               <asp:RequiredFieldValidator ControlToValidate="txtCadNewChave" 
                                                                  ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvtxtCadNewChave" Display="None"
                                                                  runat="server" ValidationGroup="IncluirCategoriaXChave" ></asp:RequiredFieldValidator>
                                                               <asp:ValidatorCalloutExtender ID="vcetxtCadNewChave" runat="server" TargetControlID="rfvtxtCadNewChave"></asp:ValidatorCalloutExtender>
                                                            </FooterTemplate> 
                                                            <ItemTemplate> 
                                                               <asp:Label ID="lblChave" Width="350" runat="server" Text='<%# Bind("Value") %>'></asp:Label> 
                                                            </ItemTemplate> 
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Editar" ShowHeader="False"> 
                                                            <EditItemTemplate> 
                                                                <asp:ImageButton ID="ImageButton1" runat="server" CommandName="Update" ToolTip="Salvar" ValidationGroup="SalvarCategoriaXChave" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/accept.png"/>
                                                                <asp:ImageButton ID="ImageButton2" runat="server" CommandName="Cancel" ToolTip="Cancelar" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/exclamacao.png"/>
                                                            </EditItemTemplate> 
                                                            <FooterTemplate> 
                                                                <asp:ImageButton ID="ImageButton3" runat="server" CommandName="AddNew" ToolTip="Incluir" ValidationGroup="IncluirCategoriaXChave" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/add.png"/>
                                                            </FooterTemplate> 
                                                            <ItemTemplate> 
                                                                <asp:ImageButton ID="ImageButton4" runat="server" CommandName="Edit" ToolTip="Editar" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif"/>
                                                                <asp:ImageButton ID="ImageButton5" runat="server" CommandName="Delete" ToolTip="Excluir" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/remove.png"/>
                                                            </ItemTemplate> 
                                                        </asp:TemplateField> 
                                                    </Columns>
                                                </asp:GridView>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <hr />
                                            <table  border="0" cellpadding="0" cellspacing="3">
                                                <tr>
                                                    <td class="FormLabel">
                                                        Data Cadastro:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Cadastrado por:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Data Edi&ccedil;&atilde;o:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Editado por:
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltDataCadastro" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltCadastradoPor" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltDataEdicao" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltEditadoPor" runat="server"></asp:Literal>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:TabPanel>
            </asp:TabContainer>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
